<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <title>地图</title>
    <script src="assets/js/phaser.min.js"></script>
    <script type="text/javascript">
        var game = new Phaser.Game(900, 600, Phaser.CANVAS, 'game');
        game.states = {};
        game.states.boot = function () {
            this.preload = function () {
                this.scale.scaleMode = Phaser.ScaleManager.EXACT_FIT;
                this.scale.refresh();
                game.load.image('loading', 'assets/pics/preloader.gif');
            };
            this.create = function () {
                game.state.start('preload');
            };
        };
        game.states.preload = function () {
            this.preload = function () {
                var preloadSprite = game.add.sprite(10, game.height / 2, 'loading');
                game.load.setPreloadSprite(preloadSprite);
                game.load.image('background', 'assets/pics/map/main.jpg');
                game.load.image('flag', 'assets/pics/map/flag.png');
                game.load.image('huangcheng', 'assets/pics/map/huangcheng.png');
                game.load.image('huji', 'assets/pics/map/huji.png');
                game.load.image('kanghao', 'assets/pics/map/kanghao.png');
                game.load.image('mingjiao', 'assets/pics/map/mingjiao.png');
                game.load.image('taohua', 'assets/pics/map/taohua.png');
                game.load.image('weizhou', 'assets/pics/map/weizhou.png');
                game.load.image('yumen', 'assets/pics/map/yumen.png');
            };
            this.create = function () {
                game.state.start('main');
            };
        };
        game.states.main = function () {
            var kanghao;
            var text;
            this.create = function () {
                game.add.sprite(0, 0, 'background');
                //kanghao
                kanghao = game.add.sprite(560, 422, 'kanghao');
                kanghao.scale.setTo(0.34, 0.34);
                kanghao.anchor.set(0.5);
                kanghao.inputEnabled = true;
                kanghao.events.onInputDown.add(function () {
                    location.href='106.15.228.191';
                }, this);
                text = game.add.text(400, 500, '', { fill: '#000000' });
                var penglai = game.add.sprite(660, 125, 'taohua');
                penglai.scale.setTo(0.08, 0.08);
                var changan = game.add.sprite(365, 200, 'huangcheng');
                changan.scale.setTo(0.2, 0.2);
                var huji = game.add.sprite(270, 210, 'huji');
                huji.scale.setTo(0.07, 0.07);
                var yumen = game.add.sprite(280, 110, 'yumen');
                yumen.scale.setTo(-0.2, 0.2);
                var weizhou = game.add.sprite(25, 270, 'weizhou');
                weizhou.scale.setTo(0.15, 0.15);
                var guangming = game.add.sprite(20.20, 'mingjiao');
                guangming.scale.setTo(0.1, 0.1);
            };
            this.update = function () {
                if (kanghao.input.pointerOver()) {
                    kanghao.scale.setTo(0.54, 0.54);
                    text.setText("康豪山庄");
                } else {
                    kanghao.scale.setTo(0.34, 0.34);
                    text.setText("");
                }
            }
        };
        game.state.add('boot', game.states.boot);
        game.state.add('preload', game.states.preload);
        game.state.add('main', game.states.main);
        game.state.start('boot');


    </script>
    <style>
        html, body {
            margin: 0;
            padding: 0;
        }

        .game {
            position: absolute;
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
<div id="game" class="game">

</div>

</body>
</html>